package com.ruoyi.web.controller.monitor;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.prometheus.PromQLQueryVo;
import com.ruoyi.common.utils.prometheus.PrometheusUtils;
import com.ruoyi.framework.web.domain.Server;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 指标数据获取
 * 
 * @author gonianer
 */
@RestController
@RequestMapping("/metrics/info")
public class MetricsController
{

    @GetMapping("/line")
    public AjaxResult getLineMetrics(PromQLQueryVo queryVo) throws Exception
    {
        Map result = PrometheusUtils.queryRange(queryVo);
        return AjaxResult.success(result);
    }
}
